package main.java.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Freemarker生成
 * @author gzq
 *
 */
public class FreemarkerGenerate {

	public static void main(String[] args) {
		FreemarkerCore fc = new FreemarkerCore();
		HashMap<String, Object> ftlMap = new HashMap<String, Object>();
		ftlMap.put("title", "水果组合哟");
		
		List<Fruits> fruitList = new ArrayList<Fruits>();
		Fruits f1 = new Fruits();
		f1.setName("桃子1");
		Fruits f2 = new Fruits();
		f2.setName("桃子2");
		Fruits f3 = new Fruits();
		f3.setName("桃子3");
		fruitList.add(f1);
		fruitList.add(f2);
		fruitList.add(f3);
		
		//list集合
		ftlMap.put("fruitList", fruitList);
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("fruit1", "水蜜桃1");
		paramMap.put("fruit2", "水蜜桃2");
		paramMap.put("fruit3", "水蜜桃3");
		paramMap.put("fruit4", null);
		
		//map集合
		ftlMap.put("paramMap", paramMap);
		
		fc.freemarkerParse(ftlMap);
		
	}
	
}
